﻿package mortal.game.scene3D.player.head
{
    import baseEngine.core.*;
    import flash.geom.*;
    import mortal.game.scene3D.display3d.icon3d.*;

    public class QQHuangzhuan extends Pivot3D
    {
        protected var qqHuangzhuan_Lv:Icon3D;
        protected var qqHuangzhuan_Bg:Icon3D;
        public var width:int = 20;
        private var _curLv:int;
        private var _curBgFlag:String;
        private var _bgPos:Point;
        private static const qqHuangzhuanList:Array = [EotherIcons2Type.Yellow1, EotherIcons2Type.Yellow2, EotherIcons2Type.Yellow3, EotherIcons2Type.Yellow4, EotherIcons2Type.Yellow5, EotherIcons2Type.Yellow6, EotherIcons2Type.Yellow7, EotherIcons2Type.Yellow8];
        private static const qqHuangzhuanListPast:Array = [EotherIcons2Type.YellowPast1, EotherIcons2Type.YellowPast2, EotherIcons2Type.YellowPast3, EotherIcons2Type.YellowPast4, EotherIcons2Type.YellowPast5, EotherIcons2Type.YellowPast6, EotherIcons2Type.YellowPast7, EotherIcons2Type.YellowPast8];
        private static const qqLanzhuanList:Array = [EotherIcons2Type.Blue1, EotherIcons2Type.Blue2, EotherIcons2Type.Blue3, EotherIcons2Type.Blue4, EotherIcons2Type.Blue5, EotherIcons2Type.Blue6, EotherIcons2Type.Blue7];
        private static const qqLanzhuanListPast:Array = [EotherIcons2Type.BluePast1, EotherIcons2Type.BluePast2, EotherIcons2Type.BluePast3, EotherIcons2Type.BluePast4, EotherIcons2Type.BluePast5, EotherIcons2Type.BluePast6, EotherIcons2Type.BluePast7];

        public function QQHuangzhuan(param1:String)
        {
            this._bgPos = new Point();
            super(param1);
            return;
        }// end function

        override public function dispose(param1:Boolean = true) : void
        {
            if (this.qqHuangzhuan_Lv)
            {
                Icon3DFactory.instance.disposeIcon3D(this.qqHuangzhuan_Lv);
                this.qqHuangzhuan_Lv = null;
            }
            if (this.qqHuangzhuan_Bg)
            {
                Icon3DFactory.instance.disposeIcon3D(this.qqHuangzhuan_Bg);
                this.qqHuangzhuan_Bg = null;
            }
            this._curLv = -1;
            this._curBgFlag = null;
            super.dispose(param1);
            return;
        }// end function

        public function show() : void
        {
            if (this.qqHuangzhuan_Lv)
            {
                this.qqHuangzhuan_Lv.show();
            }
            if (this.qqHuangzhuan_Bg)
            {
                this.qqHuangzhuan_Bg.show();
            }
            return;
        }// end function

        public function hide() : void
        {
            if (this.qqHuangzhuan_Lv)
            {
                this.qqHuangzhuan_Lv.hide();
            }
            if (this.qqHuangzhuan_Bg)
            {
                this.qqHuangzhuan_Bg.hide();
            }
            return;
        }// end function

        public function getLanZhuanBg(param1:Boolean, param2:Boolean, param3:Boolean, param4:Point) : OtherIconInfo
        {
            if (param1)
            {
                this.width = 20;
                param4.setTo(6, 8);
                if (param2)
                {
                    if (param3)
                    {
                        return EotherIcons2Type.QQblueBgYearBgFailure_Deluxe;
                    }
                    return EotherIcons2Type.QQblueBgYearBgFailure;
                }
                else
                {
                    if (param3)
                    {
                        return EotherIcons2Type.QQblueYearBg_Deluxe;
                    }
                    return EotherIcons2Type.QQblueYearBg;
                }
            }
            else
            {
                this.width = 10;
                param4.setTo(0, 8);
                if (param2)
                {
                    if (param3)
                    {
                        return EotherIcons2Type.QQblueBgBgFailure_Deluxe;
                    }
                    return EotherIcons2Type.QQblueBgBgFailure;
                }
            }
            return EotherIcons2Type.QQblueBg_Deluxe;
            return EotherIcons2Type.QQblueBg;
        }// end function

        public function getHuangZhuanBg(param1:Boolean, param2:Boolean, param3:Point) : OtherIconInfo
        {
            if (param1)
            {
                this.width = 20;
                param3.setTo(6, 9);
                if (param2)
                {
                    return EotherIcons2Type.QQyellowBgYearBgFailure;
                }
                return EotherIcons2Type.QQyellowYearBg;
            }
            else
            {
                this.width = 10;
                param3.setTo(0, 9);
                if (param2)
                {
                    return EotherIcons2Type.QQyellowBgBgFailure;
                }
            }
            return EotherIcons2Type.QQyellowBg;
        }// end function

        public function updateQQHuangzhuan(param1:int, param2:int, param3:Boolean, param4:Boolean = false, param5:Boolean = false) : void
        {
            var _loc_7:Array = null;
            var _loc_8:OtherIconInfo = null;
            var _loc_9:OtherIconInfo = null;
            var _loc_10:Boolean = false;
            var _loc_11:Icon3D = null;
            var _loc_6:* = "" + param3 + param4 + param5 + param1;
            if (param2 > 0)
            {
                if (param1 == 1)
                {
                    param2 = param2 > 8 ? (8) : (param2);
                    _loc_7 = param4 ? (qqHuangzhuanListPast) : (qqHuangzhuanList);
                    _loc_8 = this.getHuangZhuanBg(param3, param4, this._bgPos);
                }
                else
                {
                    param2 = param2 > 7 ? (7) : (param2);
                    _loc_7 = param4 ? (qqLanzhuanListPast) : (qqLanzhuanList);
                    _loc_8 = this.getLanZhuanBg(param3, param4, param5, this._bgPos);
                }
                _loc_9 = _loc_7[(param2 - 1)];
                if (!this.qqHuangzhuan_Lv)
                {
                    this.qqHuangzhuan_Lv = Icon3DFactory.instance.createOtherIcon3D("otherIcons2.png", _loc_9);
                    this.addChild(this.qqHuangzhuan_Lv);
                    this._curLv = param2;
                }
                if (this._curLv != param2)
                {
                    this.qqHuangzhuan_Lv.setImgPos(_loc_9.x, _loc_9.y, _loc_9.xNum, _loc_9.yNum);
                }
                if (!this.qqHuangzhuan_Bg)
                {
                    this.qqHuangzhuan_Bg = Icon3DFactory.instance.createOtherIcon3D("otherIcons2.png", _loc_8);
                    this.addChild(this.qqHuangzhuan_Bg);
                    this._curBgFlag = _loc_6;
                }
                if (this._curBgFlag != _loc_6)
                {
                    this.qqHuangzhuan_Bg.setImgPos(_loc_8.x, _loc_8.y, _loc_8.xNum, _loc_8.yNum);
                }
                _loc_10 = Icon3DFactory.instance.sort(this.qqHuangzhuan_Lv, this.qqHuangzhuan_Bg);
                if (_loc_10)
                {
                    _loc_11 = this.qqHuangzhuan_Lv;
                    this.qqHuangzhuan_Lv = this.qqHuangzhuan_Bg;
                    this.qqHuangzhuan_Bg = _loc_11;
                }
                this.qqHuangzhuan_Bg.x = this._bgPos.x;
                this.qqHuangzhuan_Bg.y = this._bgPos.y;
            }
            else
            {
                if (this.qqHuangzhuan_Lv)
                {
                    Icon3DFactory.instance.disposeIcon3D(this.qqHuangzhuan_Lv);
                    this.qqHuangzhuan_Lv = null;
                }
                if (this.qqHuangzhuan_Bg)
                {
                    Icon3DFactory.instance.disposeIcon3D(this.qqHuangzhuan_Bg);
                    this.qqHuangzhuan_Bg = null;
                }
            }
            this._curLv = param2;
            this._curBgFlag = _loc_6;
            return;
        }// end function

    }
}
